<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/static/component/pear/css/pear-module/dtree/dtree.css">
    <link rel="stylesheet" href="/static/component/pear/css/pear.css">
    <link rel="stylesheet" href="/webjars/layui/2.5.5/css/layui.css"  media="all">
    <style>
        *{margin: 0px auto;
            padding: 0px;
        }
        .layui-table-cell{
            height: 30px;
        }
        .q:after{
            content:'';
            display: block;
            clear: both;
        }
        .layui-table-cell{
            height: 30px;
        }
        .message li{
            float:  left;
            font-size: 16px;
            margin-right: 30px;
        }
        .message li span{
            margin-left: 4px;
        }
        .message ul{
            margin-top: 20px;
        }
        .message ul span{
            color: gray;
        }
        .XianLuXinXi{

        }
        .XianLuXinXi .zuo{
            float: left;
            width: 280px;
            height: 350px;
        }
        .XianLuXinXi .you{
            float: left;
            width: 280px;
            height: 350px;
        }
        .XianLuXinXi li{
            font-size: 14px;
            margin-top: 20px;
            margin-left: 40px;
        }
    </style>
</head>
<body>
<form class="layui-form" action="">
    <div class="layui-form-item" style="margin-top: 50px">
        <div class="layui-inline">
            <label class="layui-form-label">任务编号</label>
            <div class="layui-input-inline">
                <input type="tel" name="inspectionTaskCode" id="inspectionTaskCode" lay-verify="required|phone" autocomplete="off" class="layui-input">
            </div>
            <label class="layui-form-label">线路编号</label>
            <div class="layui-input-inline">
                <input type="tel" name="lineCode" id="lineCode" lay-verify="required|phone" autocomplete="off" class="layui-input">
            </div>
            <label class="layui-form-label">任务状态</label>
            <div class="layui-input-inline">
                <select  id="service" name="taskStatus" lay-verify="required"  class="select">
                    <option value=" ">--请选择--</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item" style="margin-top: 10px">
        <div class="layui-inline">
            <label class="layui-form-label">下发人</label>
            <div class="layui-input-inline">
                <input type="tel" name="issuedByName" id="issuedByName" lay-verify="required|phone" autocomplete="off" class="layui-input">
            </div>
            <label class="layui-form-label">下发时间：</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="issuedTime"  placeholder="" id="kaishi">
            </div>
            <div class="layui-form-mid">————————</div>
            <div class="layui-input-inline">
                <input type="text" class="layui-input"  name="issuedTime" placeholder="" id="jeiShu">
            </div>
            <button type="button" class="layui-btn" style="margin-left: 80px" onclick="ChaXun()">查询</button>
        </div>
    </div>
</form>
<div class="layui-container" style="width:100%;margin-top:50px ">

    <table id="AttTb" lay-filter="AttTb" lay-data="AttTb"></table>
</div>

<div id="add" style="display: none" class="layui-form-item">
    <div class="layui-form-item">
        <div class="layui-inline" style="margin-left: 20px">
            <fieldset class="layui-elem-field site-demo-button" style="margin-top: 10px">
                <legend>线路</legend>
                    <ul id="demoTree1" class="dtree" data-id="0" style="height: 420px">
                    </ul>
            </fieldset>
        </div>
    <div class="layui-inline">
        <form action="" class="layui-form"  lay-filter="addForm">
        <fieldset class="layui-elem-field site-demo-button" style="margin-top: 10px;height: 442px;width: 570px;margin-left: 20px">
            <legend>信息</legend>
            <input type="hidden" name="lineName" id="lineName">
            <input type="hidden" name="taskId" id="taskId">
            <input type="hidden" name="creationTime" id="creationTime">
                <label class="layui-form-label">线路编号</label>
                <div class="layui-input-block">
                    <input type="text" name="lineCode" lay-verify="title" autocomplete="off" disabled="disabled" id="XianLu"  style="border: none" class="layui-input">
                </div>
                <label class="layui-form-label">杆塔编号</label>
                <div class="layui-input-block">
                    <input type="text" name="poleCode" lay-verify="title" autocomplete="off" disabled="disabled" id="GanTai" style="border: none" class="layui-input">
                 </div>
                <div class="layui-form-item" style="">
                        <label class="layui-form-label">缺陷类型</label>
                        <div class="layui-input-block" style="width: 50%;">
                            <select  id="queLei" name="bugType" lay-filter="queLei"  lay-verify="required"  class="select">
                                <option value=" ">--请选择--</option>
                            </select>
                        </div>
                    <label class="layui-form-label" style="margin-top: 20px">缺陷级别</label>
                    <div class="layui-input-block" style="margin-top: 20px;width: 50%">
                        <select  id="queJi" name="bugLevel" lay-filter="queJi" lay-verify="required"  class="select">
                            <option value=" ">--请选择--</option>
                        </select>
                    </div>
                </div>
        <label class="layui-form-label">完好率</label>
        <div class="layui-input-block" style="width: 50%">
            <input type="text" name="intactRate" lay-verify="title" autocomplete="off"  class="layui-input">
        </div>
        <label class="layui-form-label">发现时间</label>
        <div class="layui-input-block">
            <input type="text" name="discoverTime" lay-verify="title" autocomplete="off" id="FaXian" disabled="disabled" style="border: none" class="layui-input" th:value="${#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd HH:mm:ss')}">
        </div>
        <label class="layui-form-label">发现人员</label>
        <div class="layui-input-block">
            <input type="text" name="discovererName" lay-verify="title"  autocomplete="off" id="FaXianRenYuan" th:value="${session.loginUser.userName}"  disabled="disabled" style="border: none" class="layui-input ">
        </div>
        <div class="layui-form-item layui-form-text" style="width: 70%;">
            <label class="layui-form-label">普通文本域</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" name="bugDesc" cols="1" rows="1" class="layui-textarea"></textarea>
            </div>
        </div>
        </fieldset>
        </form>
    </div>

</div>
</div>
</div>



<!--查看表单-->
<div id="chKan" style="display:none;margin: auto auto" class="aa">
    <fieldset class="layui-elem-field site-demo-button" style="margin-top: 10px;width:880px;">
        <legend>基本信息</legend>

        <div class="layui-field-box message" >
            <ul class="message01 q">
                <li>任务编号:<span class="inspectionTaskCode"></span></li>
                <li>任务名称:<span class="inspectionTaskName"></span></li>
                <li>巡检线路:<span class="lineName"></span></li>
                <li>起始杆号:<span class="startPoleCode"></span></li>

            </ul>
            <ul class="message02 q">
                <li>终止杆号:<span class="endPoleCode"></span></li>
                <li style="margin-left: 15px">下发人:<span class="issuedByName"></span></li>
                <li style="margin-left: 15px">下发时间:<span class="issuedTime"></span></li>
            </ul>
            <ul class="message02 q">
                <li>任务状态:<span class="taskStatus"></span></li>
                <li>完成时间:<span class="finishTime"></span></li>
            </ul>
        </div>

    </fieldset>
    <fieldset class="layui-elem-field site-demo-button" style="margin-top: 10px;width: 200px;height:350px; float: left;margin-left: 20px">
        <legend>线路</legend>
        <ul id="demoTree" class="dtree" data-id="0" style=""></ul>
    </fieldset>
    <fieldset class="layui-elem-field" style="width:600px;height: 350px;float: right;margin-top: 10px;margin-right: 20px">
        <legend>信息</legend>
        <div class="XianLuXinXi">
            <div class="zuo">
                <ul class="q">
                    <li>线路编码:<span class="lineCode" id="a"></span></li>
                    <li>有无故障:<span class="isBug" id="a2"></span></li>
                    <li>缺陷类型:<span class="bugTypeName" id="a3"></span></li>
                    <li>缺陷描述:<span class="bugDesc" id="a4"></span></li>
                    <li>巡检时间:<span class="inspectTime" id="a5"></span></li>
                    <li>缺陷发现人:<span class="discovererName" id="a6"></span></li>
                    <li>下发人员:<span class="createBy" id="a7"></span></li>
                </ul>
            </div>
            <div class="you">
                <li>杆塔编码:<span class="poleCode" id="a8"></span></li>
                <li>*完好率:<span class="intactRate" id="a9"></span></li>
                <li>缺陷级别:<span class="bugLevel" id="d"></span></li>
                <li><span>&nbsp;</span></li>
                <li><span>&nbsp;</span></li>
                <li>发现时间:<span class="discoverTime" id="c"></span></li>
                <li>下发时间:<span class="creationTime" id="b"></span></li>
            </div>
        </div>

    </fieldset>
</div>



<!--操作修改-->
<div id="CaoXiu" style="display:none;margin: auto auto" class="aa">
    <div class="layui-inline" style="margin-left: 20px">
        <fieldset class="layui-elem-field site-demo-button" style="margin-top: 10px">
            <legend>线路</legend>
            <ul id="demoTree2" class="dtree" data-id="0" style="height: 420px">
            </ul>
        </fieldset>
    </div>
    <div class="layui-inline">
        <form action="" class="layui-form" id="updateForm" lay-filter="updateForm">
            <fieldset class="layui-elem-field site-demo-button" style="margin-top: 10px;height: 442px;width: 570px;margin-left: 20px">
                <legend>信息</legend>
                <input type="hidden" name="taskId" id="YinId">
                <label class="layui-form-label">线路编号</label>
                <div class="layui-input-block">
                    <input type="text" name="lineCode" lay-verify="title"  autocomplete="off" disabled="disabled" id="XianBian"  style="border: none" class="layui-input">
                </div>
                <label class="layui-form-label">杆塔编号</label>
                <div class="layui-input-block">
                    <input type="text" name="poleCode" lay-verify="title" autocomplete="off" disabled="disabled" id="GanBian" style="border: none" class="layui-input">
                </div>
                <div class="layui-form-item" style="">
                    <label class="layui-form-label">缺陷类型</label>
                    <div class="layui-input-block" style="width: 50%;">
                        <select  id="queLei1" name="bugType" lay-filter="queLei"  lay-verify="required"  class="select">
                            <option value="0">--请选择--</option>
                        </select>
                    </div>
                    <label class="layui-form-label" style="margin-top: 20px">缺陷级别</label>
                    <div class="layui-input-block" style="margin-top: 20px;width: 50%">
                        <select  id="queJi1" name="bugLevel" lay-filter="queJi" lay-verify="required"  class="select">
                            <option value="0">--请选择--</option>
                        </select>
                    </div>
                </div>
                <label class="layui-form-label">完好率</label>
                <div class="layui-input-block" style="width: 50%">
                    <input type="text" name="intactRate" id="WanHao" lay-verify="title" autocomplete="off"  class="layui-input">
                </div>
                <label class="layui-form-label">发现时间</label>
                <div class="layui-input-block">
                    <input type="text" name="discoverTime" lay-verify="title" autocomplete="off" id="FaShi" disabled="disabled" style="border: none" class="layui-input">
                </div>
                <label class="layui-form-label">发现人员</label>
                <div class="layui-input-block">
                    <input type="text" name="discovererName" lay-verify="title"  autocomplete="off" id="FaRen"   disabled="disabled" style="border: none" class="layui-input ">
                </div>
                <div class="layui-form-item layui-form-text" style="width: 70%;">
                    <label class="layui-form-label">普通文本域</label>
                    <div class="layui-input-block">
                        <textarea placeholder="请输入内容" id="WenBen" name="bugDesc" cols="1" rows="1" class="layui-textarea"></textarea>
                    </div>
                </div>
            </fieldset>
        </form>
    </div>
</div>

<script type="text/html" id="active">
    <div class="layui-input-block" style="margin-left: 0px">
        <button type="button" class="layui-btn layui-btn-primary layui-btn-sm"  lay-event="ChaKan" >查看</button>
        {{#  if(d.taskStatus == 32){  }}
        <button type="button" class="layui-btn layui-btn-normal layui-btn-sm layui-btn-disabled" lay-event="zhixingluru">执行录入</button>
        {{# }else if(d.taskStatus==34){ }}
        <button type="button" class="layui-btn layui-btn-normal layui-btn-sm layui-btn-disabled" lay-event="zhixingluru" >执行录入</button>
        {{# }else{ }}
        <!--"-->
        <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="FenPeiRenWu">回执录入</button>
        {{# } }}

        {{#  if(d.taskStatus == 33){  }}
        <button type="button" class="layui-btn layui-btn-normal layui-btn-sm layui-btn-disabled" lay-event="zh">执行</button>
        <button type="button" class="layui-btn layui-btn-primary layui-btn-sm"  lay-event="update">修改</button>
        {{# }else if(d.taskStatus==34){ }}
        <button type="button" class="layui-btn layui-btn-normal layui-btn-sm layui-btn-disabled" lay-event="zh" >执行</button>
        <button type="button" class="layui-btn layui-btn-primary layui-btn-sm layui-btn-disabled"  lay-event="updatea">修改</button>
        {{# }else{ }}
        <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="zhixing">执行</button>
        <button type="button" class="layui-btn layui-btn-primary layui-btn-sm  layui-btn-disabled"  lay-event="updatea">修改</button>
        {{# } }}
    </div>
    <!--回执-->
</script>
<script  type="text/javascript"   src="/webjars/layui/2.5.5/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="/static/component/pear/pear.js" ></script>
<script>
    layui.use(["jquery","layer","form","table","laydate","dtree"],function () {
        let form = layui.form;
        let $ = layui.$;
        let laydate = layui.laydate;
        let table = layui.table;
        let dtree=layui.dtree;
        table.render({
            id: "AttTb",
            elem: "#AttTb",
            url: "/XunJianZhiXing/XunJianCha",
            cols: [
                [
                    {field:'id',  title: 'ID',sort: true}
                    ,{field: 'lineCode',title: '所属线路',hide: true}
                    ,{field:'inspectionTaskCode', title: '任务编号'}
                    ,{field:'inspectionTaskName', title: '任务名称'}
                    ,{field: 'lineName',title:'所属线路名字'}
                    ,{field: 'issuedByName',title:'下发人'}
                    ,{field: 'issuedTime',title:'下发时间'}
                    ,{field: 'taskStatus',title:'任务状态',templet: function(d){
                        return d.taskStatus==32?"已分配":d.taskStatus==33?"执行中":d.taskStatus==34?"已完成":""}}
                    ,{field: 'finishTime',title:'任务完成时间',templet: function(d){
                        return d.finishTime==null?"——————":d.finishTime;
                    }}
                    ,{field: 'lineName',title:'所属线路名字'}
                    ,{field: 'startPoleCode',title:'起始杆号'}
                    ,{field: 'endPoleCode',title:'终止杆子号'}
                    ,{field: 'aa',title:'操作',templet:"#active",width:"280"}
                ]
            ],
            page: {
                limit: 4,
                limits: [4, 8, 12]
            }

        })
        laydate.render({
            elem: '#kaishi'
        });
        laydate.render({
            elem: '#jeiShu'
        });
        /*下拉框赋值*/
        $.ajax({
            url:"/XunJianZhiXing/XiaLaKuang",
            dataType: 'json',
            success: function(data) {
                if (data!== null) {
                    $("#service").empty();
                    $("#service").append(new Option("--请选择--", " "));
                    $.each(data, function(index, item) {
                        $('#service').append(new Option(item.configName,item.id));
                    });
                } else {
                    $("#service").append(new Option("暂无数据",""));
                }
                //重新渲染
                form.render("select");
            }
        })

        //表格监听
        table.on("tool(AttTb)",function ({data,event}) {
            switch (event) {
                case "FenPeiRenWu":
                    console.log(data.lineName)
                    console.log(data)
                    //回执录入
                    HuiZhi(data);
                    break;
                case "del":
                    del(data.id);
                    break;
                case "ChaKan":
                    console.log(data)
                    chaKan(data)
                    break;
                case "FenPeiRenWu":
                    FenPeiRenWu(data.id,data.taskStatusName);
                    break;
                case "zhixing":
                    ZhiXing(data);
                    break;
                case "update":
                    XiuGai(data);
                    break;
            }
        })

        // 回执点击树形控件赋值
        dtree.on("node('demoTree1')" ,function(obj){
            //拿到线路名称
            console.log(obj.param.context);
            console.log(obj.param);
            $.ajax({
                url:"/XunJianZhiXing/ChaXianLu?poleCode="+obj.param.context,
                dataType: 'json',
                success: function(data){
                    $("#XianLu").val(data.lineCode);
                    $("#GanTai").val(data.poleCode);
                }
            })
        });
    })
    //查询按钮
    function ChaXun() {
        layui.use(['form','layedit', 'laydate','table','jquery'], function(){
            var $ = layui.$;
            let inspectionTaskCode=$("#inspectionTaskCode").val();
            let lineCode=$("#lineCode").val();
            let taskStatus=$("#service").val();
            let issuedByName=$("#issuedByName").val();
            let kai=$("#kaishi").val();
            let jie=$("#jeiShu").val();
            let where={inspectionTaskCode,lineCode,taskStatus,issuedByName,kai,jie,curr:1};
            layui.table.reload("AttTb",{where});
        });
    }
    //回执按钮
    function HuiZhi(date) {
        let dd=null;
        layui.use(["layer","form","jquery","table","dtree"],function () {
            let layer=layui.layer;
            let $=layui.jquery;
            let dtree=layui.dtree;
            let form=layui.form;
            $("#taskId").val(date.id);
            $("#lineName").val(date.lineName);
            $("#creationTime").val(date.issuedTime);
            $("#createBy").val(date.issuedByName);
            dtree.render({
                elem:"#demoTree1",
                 url:"/XunJianZhiXing/xianlu?lineName="+date.lineName,
                // url:"/static/admin/data/ceshi01.json",
                type:"all",
                method:"get",
                // request:{"lineName":date},
                // initLevel:"1",
                // icon:'2',
                // dataStyle: "layuiStyle",  //使用layui风格的数据格式
                // dataFormat: "list",  //配置data的风格为list
                // response:{message:"msg"},
                // checkbar:true, //开启复选框
                // response:{message:"msg",statusCode:0}  //修改response中返回数据的定义
            });
            // $("#add>form")[0].reset();
            layer.open({
                type:1,
                title:" 巡检任务回执录入",
                area:["950px","600px"],
                btn:["上传回执","保存","取消"],
                content:$("#add"),
                yes(){
                        let id=date.id;
                       /*修改任务状态*/
                       $.post("/XunJianZhiXing/SiXiuZhuang",{"id":id})
                        .done(({msg})=>{
                            layer.close(layer.index);
                            layui.table.reload("AttTb");
                            // layer.msg(msg);
                        })
                       /*修改完成时间*/
                       $.post("/XunJianZhiXing/ShiJianSiXiuZhuang",{"id":id})
                        .done(({msg})=>{
                            layer.close(layer.index);
                            layui.table.reload("AttTb");
                            // layer.msg(msg);
                       })
                },
                btn2:function(){
                    let params=layui.form.val("addForm");
                    //
                    console.log(params)
                    $.post("/XunJianZhiXing/ziBiaoXinZeng",params,function(date) {
                        // layer.close(layer.index);
                        layui.table.reload("AttTb");
                        // alert("吃屎去吧");
                        layer.msg(date.msg);
                    })

                },
                // layero,index
                success: function(){
                    /*回执缺陷类型下拉框*/
                    $.ajax({
                        url:"/XunJianZhiXing/QueLeiXia",
                        dataType: 'json',
                        success: function(data) {
                            if (data!== null) {
                                $("#queLei").empty();
                                $("#queLei").append(new Option("--请选择--", "0"));
                                $.each(data, function(index, item) {
                                    $('#queLei').append(new Option(item.configName,item.id));
                                });
                            } else {
                                $("#queLei").append(new Option("暂无数据", ""));
                            }
                            //重新渲染
                            form.render("select");
                        }
                    })
                    /*回执缺陷级别拉框*/
                    $.ajax({
                        url:"/XunJianZhiXing/ChaQueJi",
                        dataType: 'json',
                        success: function(data) {
                            if (data!== null) {
                                $("#queJi").empty();
                                $("#queJi").append(new Option("--请选择--", "0"));
                                $.each(data, function(index, item) {
                                    $('#queJi').append(new Option(item.configName,item.id));
                                });
                            } else {
                                $("#queJi").append(new Option("暂无数据", ""));
                            }
                            //重新渲染
                            form.render("select");
                        }
                    })
                }
            })
        })
    }

    //查看
    function chaKan(k) {
        layui.use(["jquery","layer","form","table",'transfer','util','popup','dtree'],function (){
            let layer=layui.layer;
            let $=layui.$;
            let table=layui.table;
            let popup = layui.popup;
            let transfer = layui.transfer;
            let form =layui.form;
            let dtree=layui.dtree;
            console.log(k)
            $(".inspectionTaskCode").html(k.inspectionTaskCode);
            $(".inspectionTaskName").html(k.inspectionTaskName);
            $(".lineName").html(k.lineName);
            $(".startPoleCode").html(k.startPoleCode);
            $(".endPoleCode").html(k.endPoleCode);
            $(".issuedByName").html(k.issuedByName);
            $(".issuedTime").html(k.issuedTime);
            if(k.taskStatus==32){
                $(".taskStatus").html("已分配");
            }else if(k.taskStatus==33){
                $(".taskStatus").html("执行中");
            }else if(k.taskStatus==34){
                $(".taskStatus").html("已完成");
            }
            $(".finishTime").html(k.finishTime);
            layer.open({
                type:1,
                title:"查看信息",
                area:["930px","620px"],
                // btn:["上传回执","保存","取消"],
                content:$("#chKan"),
                success: function(layero, index){
                    dtree.render({
                        elem:"#demoTree",
                        url:"/XunJianZhiXing/xianlu?lineName="+k.lineName,
                        // url:"/static/admin/data/ceshi01.json",
                        type:"all",
                        method:"get",
                        // request:{"lineName":date},
                        // initLevel:"1",
                        // icon:'2',
                        // dataStyle: "layuiStyle",  //使用layui风格的数据格式
                        // dataFormat: "list",  //配置data的风格为list
                        // response:{message:"msg"},
                        // checkbar:true, //开启复选框
                        // response:{message:"msg",statusCode:0}  //修改response中返回数据的定义
                    });
                }
            })
            // 查看点击树形控件赋值
            dtree.on("node('demoTree')" ,function(obj){
                //$("#queLei1").empty();
               // $("#queJi1").empty();

                //拿到线路名称
                // console.log(obj.param.context);
                // console.log(obj.param);
                // console.log(k.id)
                $.ajax({
                    url:"/XunJianZhiXing/ChaKanLu?poleCode="+obj.param.context+"&taskId="+k.id,
                    dataType: 'json',
                    success: function(data){
                        console.log(data)
                        $(".lineCode").html(data.lineCode);
                        if(data.isBug==0){
                            $(".isBug").html("无");
                        }else if(data.isBug==1){
                            $(".isBug").html("有");
                        }
                        /*缺陷类型*/
                        $(".bugTypeName").html(data.bugTypeName);
                        $(".bugDesc").html(data.bugDesc);
                        $(".inspectTime").html(data.inspectTime);
                        $(".discovererName").html(data.discovererName);
                        $(".createBy").html(data.createBy);
                        $(".poleCode").html(data.poleCode);
                        $(".intactRate").html(data.intactRate);
                        /*缺陷级别*/
                        $(".bugLevel").html(data.bugLevel);
                        $(".discoverTime").html(data.discoverTime);
                        $(".creationTime").html(data.creationTime);

                    }

                })
                $("#a").text("");
                $("#a2").text("");
                $("#a3").text("");
                $("#a4").text("");
                $("#a5").text("");
                $("#a6").text("");
                $("#a7").text("");
                $("#a8").text("");
                $("#a9").text("");
                $("#d").text("");
                $("#c").text("");
                $("#b").text("");

            });
        });
    };
    function ZhiXing(data) {
        layui.use(["jquery","layer","form","table",'transfer','util','popup','dtree'],function () {
            let layer=layui.layer;
            let $=layui.$;
            layer.confirm("确定执行吗", {title: "执行确认"}, function (index) {
                $.post("/XunJianZhiXing/ZhiSiXiuZhuang", {"id": data.id})
                    .done(({msg}) => {
                        layer.close(layer.index);
                        alert("执行成功")
                        layui.table.reload("AttTb");
                        layer.msg(msg);

                    })
            })
        })

    }
    /*操作修改*/
    function XiuGai(data) {
        layui.use(["jquery","layer","form","table",'transfer','util','popup','dtree'],function () {
            console.log(data)
            let layer=layui.layer;
            let $=layui.$;
            let table=layui.table;
            let popup = layui.popup;
            let transfer = layui.transfer;
            let form =layui.form;
            let dtree=layui.dtree;
            layer.open({
                type:1,
                title:"修改信息",
                area:["930px","580px"],
                 btn:["修改","取消"],
                content:$("#CaoXiu"),
                yes(){
                    let params=layui.form.val("updateForm");
                    console.log(params)
                    $.post("/XunJianZhiXing/CaoXiu",params,function (c) {
                        if(c.msg=="修改成功"){
                            alert("修改成功")
                            table.reload("AttTb");
                            layer.closeAll();


                        }else {
                            alert("修改失败")
                        }
                    })
                },
                success: function(layero, index){
                    dtree.render({
                        elem:"#demoTree2",
                        url:"/XunJianZhiXing/xianlu?lineName="+data.lineName,
                        type:"all",
                        method:"get",
                    });

                    /*回执缺陷类型下拉框*/
                    $.ajax({
                        url:"/XunJianZhiXing/QueLeiXia",
                        dataType: 'json',
                        success: function(data) {
                            if (data!== null) {
                                $("#queLei1").empty();
                                $("#queLei1").append(new Option("--请选择--", "0"));
                                $.each(data, function(index, item) {
                                    $('#queLei1').append(new Option(item.configName,item.id));
                                });
                            } else {
                                $("#queLei1").append(new Option("暂无数据", ""));
                            }
                            //重新渲染
                            form.render("select");
                        }
                    })

                    /*回执缺陷级别拉框*/
                    $.ajax({
                        url:"/XunJianZhiXing/ChaQueJi",
                        dataType: 'json',
                        success: function(data) {
                            if (data!== null) {
                                $("#queJi1").empty();
                                $("#queJi1").append(new Option("--请选择--", "0"));
                                $.each(data, function(index, item) {
                                    $('#queJi1').append(new Option(item.configName,item.id));
                                });
                            } else {
                                $("#queJi1").append(new Option("暂无数据", ""));
                            }
                            //重新渲染
                            form.render("select");
                        }
                    })
                }
            })

            // 查看点击树形控件赋值
            dtree.on("node('demoTree2')" ,function(obj){
                //拿到线路名称
                console.log(obj.param.context);
                console.log(obj.param);
                console.log(data.id)
                $.ajax({
                    url:"/XunJianZhiXing/ChaKanLu?poleCode="+obj.param.context+"&taskId="+data.id,
                    dataType: 'json',
                    success: function(k){
                        console.log(k)
                        $("#XianBian").val();
                        layui.form.val("updateForm",k)

                    }

                })
                $("#updateForm")[0].reset();
            });
        })

    }
</script>
</body>
</html>